<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
  <title>Bullet</title>
  <%= stylesheet_link_tag 'bullet_bb', 'coderay', :media => 'all' %>
  <%= javascript_include_tag :defaults %>
</head>
<body>
  <div id="wrap">
    
    <% form_tag topics_path, :id => 'search_form', :method => 'get' do %>
      <%= text_field_tag :search, params[:search] %>
      <%= submit_tag 'Search', :name => nil %>
    <% end %>
    
    <div id="menu">
      <%= link_to 'Users', users_path %> |
      <!-- #REFACTORME all the navigation is going up here for now - we'll need to figure out what belongs where -->
      <%= link_to 'Unanswered Posts', unanswered_path %> |
      <% if logged_in? -%>
        <%= link_to 'Unread Posts', unread_path %> |
      <% else -%>
        <%= link_to 'Recent Posts', topics_path %> |
      <% end %>
      <% if is_admin? %>
        <%= link_to 'Reports', reports_path %> |
      <% end %>
      <% if logged_in? %>
        <%= link_to 'Settings', edit_user_path(current_user) %>
        <div id="logged_in_as">
          logged in as <strong><%= link_to h(current_user.name), user_url(current_user) %></strong> (<%= link_to 'Log-Out', session_path, :method => :delete %>)
        </div>
      <% else %>
        <%= link_to 'Register', new_user_path %> |
        <%= link_to 'Log-In', new_session_path %>
      <% end %>
    </div>
    
    <h1 id="logo"><%= link_to 'Bullet', home_path %></h1>
    
    <% unless flash.empty? %>
      <% flash.each do |key, msg| %>
        <%= content_tag 'div', msg, :id => 'flash', :class => key %>
      <% end %>
    <% end %>
    <div class="clear"></div>    
    <div id="content">
    
      <%= yield %>
    
    </div>
    <div id="footer">
      <ul class='users'>
        <%  users = User.currently_online %>
        <h2><%= pluralize users.size, 'member is', 'members are' %> online</h2>
        <%  for user in users %>
        <li><%= link_to user.name, user_path(user) %></li>
        <%  end %>
      </ul>
      <div class="clear"></div>    
      <span class="powered">
        Powered by <a href="http://getbullet.com" title="Bullet - the Ruby on Rails Bulletin Board">Bullet</a>
      </span>
      <div class="clear"></div>   
    </div>
  </div>
</body>
</html>
